<!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<title>生成二维码</title>
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
	<link href="../../../css/mui.css" rel="stylesheet"/>
	<link href="../../../css/mui.min.css" rel="stylesheet"/>
	<link href="../../../css/app.css" rel="stylesheet"/>
	<style type="text/css">
		#container {
			margin: 15%;
			padding: 20px;
			width: 240px; height: 240px;
			text-align: center;
			background: #FFFFFF;
			overflow: hidden;
		}
		#qrcode {
			position: relative; 
			top: 0; left: 0;
		}
		#imgUrl {
			width: 30px;
			border-radius: 5px;
			position: relative;
			top: -120px; left: 0px;
		}
		.app-btn {
			text-align: center;
		}
		.app-btn button {
			font-size: 20px;
		}
	</style>
</head>
<body>
	<!-- 头部TITLE -->
	<header class="mui-bar mui-bar-nav">
		<span class="mui-icon mui-icon-back" 
			onclick="mui.back()"></span>
		<h1 class="mui-title">生成二维码</h1>
	</header>
	<!-- 头部TITLE -->
	
	<!-- 主体部分 -->
	<div style="height:45px;"></div>
	<div id="container">
		<div id="qrcode"></div>
		<img src="../../../imgs/icon.png" id="imgUrl">
	</div>
<!-- 	<div class="app-btn">
		<button type="button">点击分享</button>
		<button type="button">好友的码</button>
	</div> -->
	<div class="app-btn">
		截图扫描自己的码，奖励更丰厚哦！
	</div>
	<div style="height:45px;"></div>
	<!-- 主体部分 -->
	
	<!-- 底部菜单 -->
	<nav class="mui-bar mui-bar-tab">
		<a class="mui-tab-item" onclick="jumpToIndex()">
			<span class="mui-icon mui-icon-home"></span>
			<span class="mui-tab-label">首页</span>
		</a>
		<a class="mui-tab-item" onclick="jumpToMarket()">
			<span class="mui-icon mui-icon-download"></span>
			<span class="mui-tab-label">库</span>
		</a>
		<a class="mui-tab-item mui-active" onclick="jumpToReward()">
			<span class="mui-icon mui-icon-spinner-cycle"></span>
			<span class="mui-tab-label">奖励</span>
		</a>
		<a class="mui-tab-item" onclick="jumpToMy()">
			<span class="mui-icon mui-icon-contact"></span>
			<span class="mui-tab-label">我的</span>
		</a>
	</nav>
	<!-- 底部菜单 -->
</body>
</html>

<script src="../../../js/mui.js"></script>
<script src="../../../js/app.js"></script>
<script src="../../../js/views/view.js"></script>
<script src="../../../js/views/jquery.min.js"></script>
<script src="../../../js/views/jquery.qrcode.min.js"></script>
<script type="text/javascript">
	var sys = cacheGet(sysKey);
	var userInfo = cacheGet(userInfoKey);
	var domain = sys.domain;
	var appAccess = sys.appAccess;
	var url = '/app/reward/scan/add';
	var param, prefix;
	// jQuery(function(){
	// 	mui.toast('?'+userInfo.name)
	// 	jQuery('#container').qrcode("http://jetienne.com");
	// })
	// (function($, owner) {
	// }(mui, window.app = {}));
	mui.plusReady(function () {
		if (!domain || !appAccess) {
			mui.toast('系统参数没有设置'); return
		}
		if (!userInfo || !userInfo.uid) {
			mui.toast('没有登陆'); return
		}
		param = '?uid='+userInfo.uid;
		prefix = domain + url + param;
	    var options = {
			render: "canvas",
			ecLevel: 'H',//识别度
			fill: '#000',//二维码颜色
			background: '#ffffff',//背景颜色
			quiet: 2,//边距
			width: 200,//宽度
			height: 200,
			text: prefix,//二维码内容
			//中间logo start
			mode: 4,
			mSize: 11 * 0.01,
			mPosX: 50 * 0.01,
			mPosY: 50 * 0.01,
			image:$('#imgUrl')[0],//logo图片
			//中间logo end
			label: 'jQuery.qrcode',
			fontname: 'Ubuntu',
			fontcolor: '#ff9818',
		};
		$('#qrcode').empty().qrcode(options);
	});
</script>